home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 November / PCWorld_2007-11_cd.bin / v cisle / softatlas / SDA16.exe / {app} / SDA.xpi / install.js < prev    next >
Text File  |  2006-12-11  |  1KB  |  49 lines

  1.  
  2. const gName        = "SoftAtlas Download Accelerator";
  3. const gAuthor        = "SoftAtlas";
  4. const gRegKey        = "/sda/FireFox";
  5. const gVersion        = "1.57";
  6. const gJar            = "sda.jar";
  7.  
  8. var    error             = null;
  9. var oFolder            = getFolder("Current User", "chrome");
  10. var iContentFlag    = CONTENT | PROFILE_CHROME;
  11.  
  12. // Install in App or Profile?
  13. var existsInApplication = File.exists(getFolder(getFolder("chrome"), gJar));
  14. var existsInProfile     = File.exists(getFolder(oFolder, gJar));
  15.  
  16.  
  17. // Uninstall Current
  18. if(existsInApplication || existsInProfile)
  19.     uninstall(gRegKey);
  20.  
  21. // Init
  22. initInstall(gName, gRegKey, gVersion);
  23. setPackageFolder(oFolder);
  24. error = addFile(gAuthor, gVersion, "chrome/"+ gJar, oFolder, null);
  25. error = addFile(gAuthor, gVersion, "dowload_link.htm", oFolder, null);
  26. // Register
  27. if(error == SUCCESS){
  28.     registerChrome(iContentFlag, getFolder(oFolder, gJar), "content/");
  29.     
  30.     error = performInstall(); //Install
  31.     
  32.     if(error != SUCCESS && error != 999){
  33.         switch(error){
  34.             case -215:
  35.                 alert("The installation of the extension failed.\nOne of the files being overwritten is read-only.");
  36.                 break;
  37.             case -235:
  38.                    alert("The installation of the extension failed.\nThere is insufficient disk space.");
  39.                 break;
  40.             default: 
  41.                 alert("The installation of the extension failed.\nThe error code is: " + error);
  42.         }
  43.         cancelInstall(error);
  44.     }
  45. }
  46. else{
  47.     alert("The installation failed.\n" + error);
  48.     cancelInstall(error);
  49. }